<template>
<div>
  <!-- 搜索组件 -->
  <Search @searchParent="searchParent" ref="Search"/>
  <!-- 表格组件 -->
  <Table :arr="arr" @resetparentFun="getData"/>
  <!-- 分页组件 -->
  <PageCom :total="total" :pageSize="pageSize"/>
</div>
</template>
<script>
import Search from './components/Search'
import Table from './components/Table'
import PageCom from './components/PageCom'
import { getfinance } from '../../api/finance'
export default {
   components: {
     Table,
     PageCom,
     Search
   },
   data(){
     return{
       arr:[],
      //  search:'',
       page:1,
       pageSize:12,
       total:0,
      //  value1:'',
      //  value2:'',
     }
   },
   computed:{
     search(){
       return this.$refs.Search.search
     },
     value1(){
       return this.$refs.Search.value1
     },
     value2(){
       return this.$refs.Search.value2
     },
   },
   mounted(){
     this.getData()
   },
   methods:{
     searchParent(){    //搜索订单编号筛选
        // this.search = val
        // this.value1 = val1    //上传日期筛选value
        // this.value2 = val2
        this.getData()
        
     },
  


     getData(){        
       const params ={
         search:this.search,
         page:this.page,  //页码
         pageSize:this.pageSize,   //每页多少条
         value1:this.value1,         //日期筛选value值放入params
         value2:this.value2,
       }
       console.log(params);
       getfinance(params).then(res=>{//首屏函数
        //  console.log(res);
         if(res.code == 200){
           this.arr = res.data
           this.page=1
           this.total=res.total
         }
       })
     },

   }
  
}
</script>
<style>
  
</style>